package action;

import effect.Effect;
import character.MyCharacter;
import game.CombatController;
import game.CombatUtil;

public class ActionAbility extends Action {
    protected Effect effect;

    @Deprecated
    protected ActionAbility() {}
    
    public ActionAbility(MyCharacter character, Effect effect) {
        super(character, effect.getBaseSpeed());
        this.effect = effect;
    }

    @Override
    protected void start() {
        System.out.println("starting effect...");
    }

    @Override
    protected boolean tick() {
	if(!CombatUtil.checkEffectRange(effect)) {
	    System.out.println("Target moved out of range.");
            abortAction();
	}
        return true;
    }

    @Override
    protected void complete() {
        if(CombatUtil.checkEffectRange(effect)) {
            CombatController.executeEffect(effect);
        } else {
            System.out.println("Target moved out of range.");
            abortAction();
        }
    }
    
    @Override
    protected void abort() {}

    @Override
    public void pause() {}

    @Override
    public void unpause() {}
}
